package com.zqc.elasticsearch_demo.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: zhangquancheng
 * @Description: 配置类，构建es客户端bean对象
 * @Date: 2022/6/24 10:59 下午
 */
@Configuration
public class ElasticsearchClientConfigration {
    @Bean
    public RestHighLevelClient esClient(){
        return new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost("localhost", 9200, "http")));
    }
}
